<jsp:directive.include file="/jsp/includes/taglibs.jsp" />

<script>
	function search() {
		var url = "<c:url value="/admin/user/search"/>";
		var vars = $("#accountSearchCommand").serializeArray();
		$("#searchResults").empty();
		$("#searchResults").show();
		$("#searchResults").load(url, vars, function () {
			$("#searchResultsTable").dataTable({
				"bSort": true, 
				"bAutowidth" : true	
			}) ;
			
		});
	}
</script>
<div class="left_50">
<form:form commandName="accountSearchCommand" onsubmit="search(); return false;">
		<fieldset class="full">
			<legend><spring:message code="search.account.title"/></legend>

			<label for="name"><spring:message code="search.account.name"/></label> 
	 		<form:input path="name"/>
	 		<form:errors path="name" cssClass="error"/>
	  		<br/><br/>

			<label for="email"><spring:message code="search.account.email"/></label> 
	 		<form:input path="email"/>
	 		<form:errors path="email" cssClass="error"/>
	  		<br/><br/>
	  		
			<label for="privilegeId"><spring:message code="search.account.name"/></label> 
	 		<form:select path="privilegeId" items="${ privileges }" itemValue="id" itemLabel="name">
	 		</form:select>
	 		<form:errors path="privilegeId" cssClass="error"/>
	  		<br/><br/>	  		
			<input type="submit" class="submitButton" id="submit" value="<spring:message code="search.account.submit"/>"/>
		</fieldset>
		<br/>
</form:form>
</div>
<div class="right_50">
	<fieldset class="full">
<legend><spring:message code="search.account.latest.title"/></legend>		
		<jsp:include page="accountLatest.jsp"/>
	</fieldset>
</div>
<div id="searchResults" style="display: none; clear: both;">

</div>